package cn.wanda.bi.sunshine.platform.server.controller.authorize;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import cn.wanda.bi.sunshine.platform.server.aspect.Logging;
import cn.wanda.bi.sunshine.platform.server.client.request.IMCAuthRequest;
import cn.wanda.bi.sunshine.platform.server.client.wrapper.IMCClientWrapper;
import cn.wanda.bi.sunshine.platform.server.controller.response.common.SimpleResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * Created by wangfupeng1
 */
@Api(description = "飞凡万信登录")
@RestController
@RequestMapping(value = "/v1/ffanVerify", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class AuthorizeFfanVerifyController implements Logging {

    public static final Logger logger = LoggerFactory.getLogger(AuthorizeFfanVerifyController.class);

    @Autowired
    private IMCClientWrapper imcClientWrapper;

    @ApiOperation("飞凡万信登录校验，1分钟重试次数最多5次。超过5次禁止重试。1分钟后可再试，传入参数是用户名和密码，输出数据是userName(用户名)，loginTime(登录时间)，token(验证字符串)，和sysUser(用户信息对象)")
    @RequestMapping(value = "", method = RequestMethod.POST)
    SimpleResponse verify( @RequestBody IMCAuthRequest request ) {
        return imcClientWrapper.imcAuthUser(request);
    }

}
